//package io.github.talelin.latticy.service.impl;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import io.github.talelin.latticy.bo.CalculationVO;
//import io.github.talelin.latticy.bo.CreditCardApplyVO;
//import io.github.talelin.latticy.bo.InsuranceInfo;
//import io.github.talelin.latticy.util.KieSessionUtils;
//import org.kie.api.KieBase;
//import org.kie.api.runtime.KieSession;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.ArrayList;
//import java.util.List;
//
///**
// * @authoer:wulongbo
// * @createDate:2022/7/9
// * @description:
// */
//@Service
//public class RuleService {
//    @Autowired
//    private KieBase kieBase;
//    public void rule(){
//        KieSession kieSession = kieBase.newKieSession();
//        kieSession.fireAllRules();
//        kieSession.dispose();
//    }
//
//    //个人所得税计算
//    public CalculationVO calculate(CalculationVO calculation){
//        KieSession kieSession = kieBase.newKieSession();
//        kieSession.insert(calculation);
//        kieSession.fireAllRules();
//        kieSession.dispose();
//        return calculation;
//    }
//
//    //调用Drools规则引擎实现信用卡申请
//    public CreditCardApplyVO creditCardApply(CreditCardApplyVO creditCardApplyVO){
//        KieSession session = kieBase.newKieSession();
//        System.out.println(JSON.toJSON(creditCardApplyVO));
//        session.insert(creditCardApplyVO);
//        session.fireAllRules();
//        session.dispose();
//        return creditCardApplyVO;
//    }
//
//    public List<String> insuranceInfoCheck(InsuranceInfo insuranceInfo) throws Exception{
//        KieSession session = KieSessionUtils.getKieSessionFromXLS("D:\\insuranceInfoCheck.xls");
//        session.getAgenda().getAgendaGroup("sign").setFocus();
//        session.insert(insuranceInfo);
//        List<String> listRules = new ArrayList<>();
//        session.setGlobal("listRules", listRules);
//        session.fireAllRules();
//        return listRules;
//    }
//}
